home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / MPW_C / NEWLINEM.C next >
Text File  |  1992-06-11  |  1KB  |  29 lines

  1. In article <92111.112015U21192@uicvm.uic.edu>, U21192@uicvm.uic.edu (John Galidakis) writes:
  2.  
  3. > IM IV states that the file manager has the capability to read consequtive
  4. > bytes from files in the so called "newline mode" where a sentinel
  5. > (usually a CR) is used to terminate the Read. (page 95)
  6. > However I can't find any references on how this is done.
  7.  
  8. I used newline mode in a DA I wrote a couple of years ago; here's the 
  9. relevant section of code:
  10.  
  11.     /*
  12.      *  Here we use "newline mode", meaning that all read operations will
  13.      *  terminate at a newline character.  We select newline mode by setting
  14.      *  bit 7 of ioPosMode and specifying the newline character (here, the
  15.      *  ASCII CR (0D hex)) in the high-order byte of ioPosMode (leading to
  16.      *  the "0x0D80" below)
  17.      */
  18.      
  19.     pb.ioRefNum = refNum;
  20.     pb.ioBuffer = (Ptr) str + 1;
  21.     pb.ioReqCount = sizeof(Str255) - 1;
  22.     pb.ioPosMode = fsAtMark | 0x0D80;       /* set newline mode */
  23.     err = PBReadSync(&pb);
  24.  
  25. See the note on IM IV-121 for the complete story.
  26.  
  27. Chris Wysocki
  28. wysocki@husc.harvard.edu
  29.